package com.elitesland.metadata.entity;

import com.elitesland.core.base.BaseModel;
import com.elitesland.system.annotation.Comment;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import java.io.Serializable;
import java.util.Objects;

/**
 * <pre>元数据表列定义</pre>
 *
 * @author mir
 * @date 2020-11-21 02:24:26
 */
@Entity
@Table(name = "meta_column")
@org.hibernate.annotations.Table(appliesTo = "meta_column", comment = "表列定义")
@Data
@Accessors(chain = true)
@ApiModel(value = "表列定义", description = "表列定义")
public class MetaColumnDO extends BaseModel implements Serializable {

    private static final long serialVersionUID = -6557483150532536284L;

    @ApiModelProperty(value = "表记录ID")
    @Comment("表记录ID")
    @Column()
    Long tableId;

    @ApiModelProperty(value = "表编码")
    @Comment("表编码")
    @Column()
    String tableCode;

    @ApiModelProperty(value = "表字段ID")
    @Comment("表字段ID")
    @Column()
    Long fieldId;

    @ApiModelProperty(value = "表字段编码")
    @Comment("表字段编码")
    @Column()
    String fieldCode;

    @ApiModelProperty(value = "UDC的Domain Code")
    @Comment("UDC的Domain Code")
    @Column()
    String udcDomainCode;

    @ApiModelProperty(value = "UDC的UDC Code")
    @Comment("UDC的UDC Code")
    @Column()
    String udcCode;

    @ApiModelProperty(value = "UDC默认描述")
    @Comment("UDC默认描述")
    @Column()
    String udcDefaultDesc;

    @ApiModelProperty(value = "页面元素类型")
    @Comment("页面元素类型")
    @Column()
    String pageElement;

    @ApiModelProperty(value = "页面标签")
    @Comment("页面标签")
    @Column()
    String pageLabel;

    @ApiModelProperty(value = "移动端页面元素类型")
    @Comment("移动端页面元素类型")
    @Column()
    String mobileElement;

    @ApiModelProperty(value = "移动端页面标签")
    @Comment("移动端页面标签")
    @Column()
    String mobileLabel;

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (!(o instanceof MetaColumnDO)) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        MetaColumnDO entity = (MetaColumnDO) o;
        return getId().equals(entity.getId());
    }

    @Override
    public int hashCode() {
        return Objects.hash(getId());
    }
}